<template>
  <div class="distribution-container">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>分发方案管理</span>
          <el-button type="primary" @click="$router.push('/distribution/scheme')">
            分发方案配置
          </el-button>
        </div>
      </template>
      
      <div class="distribution-content">
        <el-row :gutter="20">
          <el-col :span="8">
            <div class="feature-card" @click="$router.push('/distribution/scheme')">
              <div class="feature-icon">
                <el-icon size="48" color="#409EFF">
                  <Share />
                </el-icon>
              </div>
              <div class="feature-title">分发方案管理</div>
              <div class="feature-desc">
                管理和配置数据分发方案，设置上游和下游渠道的匹配规则
              </div>
            </div>
          </el-col>
          
          <el-col :span="8">
            <div class="feature-card" @click="handleChannelManagement">
              <div class="feature-icon">
                <el-icon size="48" color="#67C23A">
                  <Connection />
                </el-icon>
              </div>
              <div class="feature-title">渠道管理</div>
              <div class="feature-desc">
                管理上游和下游渠道，配置渠道参数和状态
              </div>
            </div>
          </el-col>
          
          <el-col :span="8">
            <div class="feature-card" @click="handleDataMonitor">
              <div class="feature-icon">
                <el-icon size="48" color="#E6A23C">
                  <Monitor />
                </el-icon>
              </div>
              <div class="feature-title">分发监控</div>
              <div class="feature-desc">
                实时监控数据分发状态，查看分发成功率和异常信息
              </div>
            </div>
          </el-col>
        </el-row>
        
        <el-divider />
        
        <div class="recent-activity">
          <h3>最近活动</h3>
          <el-timeline>
            <el-timeline-item timestamp="2024-01-15 14:30" type="primary">
              分发方案 "银行A方案" 更新成功
            </el-timeline-item>
            <el-timeline-item timestamp="2024-01-15 12:15" type="success">
              新分发方案 "保险B方案" 创建完成
            </el-timeline-item>
            <el-timeline-item timestamp="2024-01-14 18:45" type="info">
              渠道状态检查完成，所有渠道正常运行
            </el-timeline-item>
          </el-timeline>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script setup lang="ts">
import { Share, Connection, Monitor } from '@element-plus/icons-vue'
import { useRouter } from 'vue-router'

const router = useRouter()

const handleChannelManagement = () => {
  router.push('/channel')
}

const handleDataMonitor = () => {
  router.push('/monitor')
}
</script>

<style scoped>
.distribution-container {
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: #303133;
}

.distribution-content {
  padding: 20px 0;
}

.feature-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.feature-card:hover {
  background: #ffffff;
  border-color: #409EFF;
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.15);
  transform: translateY(-2px);
}

.feature-icon {
  margin-bottom: 15px;
}

.feature-title {
  font-size: 18px;
  font-weight: bold;
  color: #303133;
  margin-bottom: 10px;
}

.feature-desc {
  font-size: 14px;
  color: #909399;
  line-height: 1.5;
}

.recent-activity {
  margin-top: 30px;
}

.recent-activity h3 {
  margin-bottom: 20px;
  color: #303133;
}
</style>